package com.tag.demo.customer;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

/**
 *
 **/
public class CustomerTag extends SimpleTagSupport {

    private String cacheControl;

    private String pragma;

    private Long expires;


    public void setCacheControl(String cacheControl) {
        this.cacheControl = cacheControl;
    }


    public void setPragma(String pragma) {
        this.pragma = pragma;
    }


    public void setExpires(Long expires) {
        this.expires = expires;
    }

    @Override
    public void doTag() throws JspException, IOException {

        HttpServletResponse response = ((HttpServletResponse)((PageContext)this.getJspContext()).getResponse());
        response.setHeader("Cache-Control", cacheControl);
        response.setHeader("Pragma", pragma);
        response.setDateHeader("Expires", expires);
    }
}
